<?php if (!defined('ROOT_DIR')) exit('No direct script access!');

class App extends Controller {
    
    public function __construct()
    {
        parent::__construct();
                
    }
    
    public function index()
    {
        
        $data = array('u.group'=> 1);
        
        try
        {
            
            $data = $this->ndb->where($data)->or_where('u.name','ervin')->join('group',array('u.group'=>'group.id'))->get('user','u');
            
            while( $row =  $data->fetchObject())
            {
                echo $row->name.'<br/>';
            }
            
        }
        catch(PDOException $e)
        {
            echo $e->getMessage();
        }
        
        
        
        $this->load->view('form');
        
        
    }
    
    public function submit()
    {
        $rules = array(
                array('field'=>'username','label'=>'User Name','rules'=>array('required')),
                array('field'=>'password','label'=>'Password','rules'=>array('required'))
        );
        
        $this->form_validation->set_rules($rules);
        
        if ( $this->form_validation->run() )
        {
            
        } else {
            $this->load->view('form');
        }
    }
    
}